\documentclass[11pt,a4paper]{article}
\usepackage{mathtools}
\usepackage[top=1.5in, bottom=1in, left=1in, right=1in]{geometry}
\usepackage{amsfonts}

\begin{document}

%%%%% A separate commands file should be created if many more are added.
%%%%% Otherwise, define your commands here.
\newcommand{\modulus}[1]{\lvert #1 \rvert}
\newcommand{\innerprod}[2]{\langle {#1},{#2} \rangle} 

\section{Analytic Geometry in The Plane}
\subsubsection{Distance between points}
Suppose we have points \( P=\begin{bmatrix}p_{1}\\p_{2}\end{bmatrix} \text{and } Q=\begin{bmatrix}q_{1}\\q_{2}\end{bmatrix} \). Then the distance between them is \[ d = \sqrt{(q_{1} - p_{1})^2 + (q_{2} - p_{2})^2} \] 

\subsubsection{Length of a vector}
The length of a vector \( \vec{v} = \begin{bmatrix}v_{1}\\v_{2} \end{bmatrix} \) is given by
\[ \modulus{\vec{v}} = \sqrt{v_{1}^2 + v_{2}^2 }  \] \\
This is equivalent to computing the length of a vector using the inner product. In this case,
\[ \modulus{\vec{v}} = \sqrt{\innerprod{\vec{v}}{\vec{v}}} \]

\subsubsection{Movement between two points}
Given two points \(P\) and \(Q\), then the movement \( \overrightarrow{PQ} \) has the coordinates 
\[ \overrightarrow{PQ} = \begin{bmatrix} q_{1}-p_{1}\\q_{2}-p_{2} \end{bmatrix} \]

\subsubsection{Sum of two movements}
By adding movements \( \vec{v} \) and \( \vec{w} \) we get the movement
\[ \vec{v} + \vec{w} = \begin{bmatrix} v_{1} + w_{1}\\v_{2} + w_{2}  \end{bmatrix} \]

\subsubsection{Parametric representation of a line}
Given a point \(P\) and a vector \( \vec{v} \neq \vec{0} \), all points one can reach from \( P \) along the direction \( \vec{v} \) lie on the line
\[ X = P + s\vec{v} \]

\subsubsection{Line intersection}
Given two lines \(X = P + s\vec{v} \) and \( Y = Q + t\vec{w} \), their point of intersection is found by solving the equation
\[P + s\vec{v} = Q + t\vec{w} \]

\newpage
%%%%% This section covers handout 3
\section{Analytic Geometry in Three Dimensions}

\subsubsection{Distance between points}
The distance between points \( P=\begin{bmatrix}p_{1}\\p_{2}\\p_{3}\end{bmatrix} \text{and } Q=\begin{bmatrix}q_{1}\\q_{2}\\q_{3}\end{bmatrix} \) is given by the formula
\[ d = \sqrt{(q_{1} - p_{1})^2 + (q_{2} - p_{2})^2 + (q_{3} - p_{3})^2} \]

\subsubsection{Length of a vector}
The length of a vector in three dimensions is almost the same as in two dimensions. For a vector \( \vec{v} = \begin{bmatrix}v_{1}\\v_{2}\\v_{3} \end{bmatrix} \) we now have
\[  \modulus{\vec{v}} = \sqrt{v_{1}^2 + v_{2}^2 + v_{3}^2 } \]
Which is once again equivalent to computing its length using the inner product:
\[ \modulus{\vec{v}} = \sqrt{\innerprod{\vec{v}}{\vec{v}}} \]

\subsubsection{Movement between two points}
Given two points \(P\) and \(Q\), then the movement \( \overrightarrow{PQ} \) has the coordinates 
\[ \overrightarrow{PQ} = \begin{bmatrix} q_{1}-p_{1}\\q_{2}-p_{2}\\q_{3}-p_{3} \end{bmatrix} \]

\subsubsection{Planes}
The parametric representation of a plane is
\[ X = P + s \vec{v} + t \vec{w} \] \\

where \( \vec{v} \neq \vec{0} \), \( \vec{w} \neq \vec{0} \) and \(\vec{v}, \vec{w} \) do not point in the same direction. \\

Three points, not all on the same line, determine a plane
\[ X = P + s \cdot \overrightarrow{PQ} + t \cdot \overrightarrow{PR} \]

\subsubsection{Plane intersection}
Given two planes, \( X = P + s\cdot\overrightarrow{PQ} + t\cdot\overrightarrow{PR} \) and \( Y = A + r\cdot\overrightarrow{AB} + q\cdot\overrightarrow{AC} \), then the line determined by their intersection is given by solving the equation
\[ P + s\cdot\overrightarrow{PQ} + t\cdot\overrightarrow{PR} = A + r\cdot\overrightarrow{AB} + q\cdot\overrightarrow{AC} \]

\newpage

\section{The Inner Product and Equational Representations}
\subsubsection{Normal to the Plane}
Given a linear equation \( ax_{1} + bx_{2} + cx_{3} = d \), the normal to the plane is
\[ \vec{n} = \begin{bmatrix} a \\ b \\ c \end{bmatrix} \] \\

This vector is orthogonal to the plane.

\subsubsection{Inner Product}
For \( \vec{v} = \begin{bmatrix} v_{1} \\ v_{2} \\ v_{3}  \end{bmatrix} \) and \( \vec{w} = \begin{bmatrix} w_{1}\\w_{2}\\w_{3} \end{bmatrix} \) the inner product is
\[ \innerprod{\vec{v}}{\vec{w}} = v_{1} \cdot w_{1} + v_{2} \cdot w_{2} + v_{3} \cdot w_{3} \]
Note that the inner product is a number and not a vector.

\subsubsection{Orthogonality}
Two vectors \( \vec{v} \) and \( \vec{w} \) are orthogonal if
\[ \innerprod{\vec{v}}{\vec{w}} = 0 \]

\subsubsection{From Parametric to Equational Representation}
Given a line in 2D \[ L = \begin{bmatrix} p_{1} \\ p_{2} \end{bmatrix} + s \cdot \begin{bmatrix} v_{1} \\ v_{2} \end{bmatrix} \] we can translate it to an equation of the form
\[ ax_{1} + bx_{2} = d \]
by setting 
\begin{align*}
 &a = -v_{2} \\
 &b = v_{1} \\
 &d = ap_{1} + bp_{2} \\
\end{align*}
We can also translate a plane in 3D 
\[ X = \begin{bmatrix} p_{1} \\ p_{2} \\ p_{3} \end{bmatrix} + s \cdot \begin{bmatrix} v_{1} \\ v_{2} \\ v_{3} \end{bmatrix} + t \cdot \begin{bmatrix} w_{1} \\ w_{2} \\ w_{3} \end{bmatrix} \] \\
\newpage
to an equation of the form 
\[ ax_{1} + bx_{2} + cx_{2} = d \] \\

by setting
\begin{align*}
 &a = v_{2}w_{3} - v_{3}w_{2} \\
 &b = v_{3}w_{1} - v_{1}w_{3} \\
 &c = v_{1}w_{2} - v_{2}w_{1} \\
 &d = ap_{1} + bp_{2} + cp_{3}
\end{align*}

\newpage
\section{Sets}
\subsubsection{Countable Sets}
A set is (infinitely) countable if it has the same cardinality as the set of natural numbers, \( \mathbb{N} \). \\
We know that a set \( S \) is (infinitely) countable if there is an injective function 
\[ f : S \rightarrow \mathbb{N} \]

\subsubsection{The set of valid Java programs is countable}
If \( \Sigma \) is a finite set, then \( \Sigma^* \) is countable. We can use this to argue that the set of valid Java programs is countable. Denote this set by \( J \).\\
\\
If we consider \( \Sigma = \text{the 65536 UNICODE character alphabet} \), then we can see that \( J \) is actually a subset of \( \Sigma^{*} \), which means \( J \) is countable.

\end{document}
